home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
c_lib.arc
/
PCSETVEC.C
< prev
next >
Wrap
Text File
|
1990-08-09
|
1KB
|
54 lines
/**
*
* Name pcsetvec -- Set interrupt vector
*
* Synopsis ercode = pcsetvec(intype,pvector);
* int ercode Error return code
* int intype Interrupt type number
* ADS *pvector Address (CS:IP) of the interrupt
* service routine or address type.
*
* Description This function sets the interrupt type to the address
* specified in pvector.
*
* Returns ercode If intype is not in the range 0 to 255
* 1 is returned; otherwise 0.
*
* Version 1.1 (C)Copyright Blaise Computing Inc. 1983, 1984
*
**/
#define utbyword(a,b) (((a)<<8)|((b)&0x00ff)) /* a is high, b low */
#define utoutrng(a,l,h) (((a)<(l)||(a)>(h))?1:0) /* Is a out of range? */
struct segads /* Offset, segment address type */
{
unsigned r;
unsigned s;
};
#define ADS struct segads /* Abbreviation */
struct dreg
{
unsigned ax,bx,cx,dx,si,di,ds,es;
};
#define DOSREG struct dreg
int pcsetvec(intype,pvector)
int intype;
ADS *pvector;
{
DOSREG dos_reg;
if (utoutrng(intype,0,255))
return(1);
utinit(&dos_reg); /* Initialize registers */
dos_reg.ax = utbyword(0x25,intype);
dos_reg.ds = pvector->s;
dos_reg.dx = pvector->r;
dos(&dos_reg);
return(0);
}